package adapter.objectadapter;

/**
 * @author shenhan
 * @create 2020/3/23 15:33
 * @description 产品
 */
public class Phone {
    public void charging(IVoltage5V voltage5V) {
        if (voltage5V.output5V() == 5) {
            System.out.println("电压正确 可以充电");
        } else {
            System.out.println("拒绝充电");
        }
    }

    public static void main(String[] args) {
        Phone phone = new Phone();
        phone.charging(new VoltageAdapter(new Voltage220V()));
    }
}
